<?php
include("auth.php");
     
if ($_SESSION['AUTH_LEVEL'] < 3) {
			echo("Sie haben keine Rechte um Abrechnungen zu generieren.");
} else {
	
	include('../config.php');
	mysql_connect($host,$username,$password);
	mysql_select_db($database);
	
	echo('
			
			<b>Übersicht des Soll- und Ist-Zustands des Getränkebestands</b>:
			<hr>
			<div><div style="float:left;width:300px;">
			<table style="width:300px;  margin-top:25px;" >
			<tr style="height: 50px; vertical-align:top"> <td><b>Produkt</b></td><td> <center><b>Soll-Menge</b></center></td><td><center><b> Ist-Menge</b> <br>(ggf. anpassen)</center></td></tr>
		');
		
	$result = mysql_query("SELECT * FROM produkte"); 

	$i = 1;
	while($row = mysql_fetch_array($result)) {
	 echo('
				<tr>
				<td  td width="35%" >
					    '.$row['Name'].'
				</td>
				
				<td  td width="20%">
					    <input type="input" id="soll_'.$i.'" value="'.$row['Lager'].'" style="width:25px; margin-left:25px;" readonly/>
				</td>
				
				<td >
					   <input type="input" id="ist_'.$i.'" value="'.$row['Lager'].'" style="width:25px; margin-left:25px;" />
					  <input type="button" value="+" onclick="add(\'ist_'.$i.'\');"/>
					   <input type="button" value="-" onclick="subt(\'ist_'.$i.'\');"/>
				</td>

				
				</tr>
			');
			
				$i++;
	} // end while
	
	echo('
				</table>
				<span style="float:right; margin-top:25px; "><select id="stockAction" name="stockAction" style="width:140px;" onchange="checkUser();">
												<option>Schwund vermerken</option>
												<option>Lager auffüllen</option>
				</select> <input type="button" value="ausführen" onclick="saveStock();"/> 
				</span>
				</div> 
				<div style="float:right; margin-top:25px;"> <b>Ereignisprotokoll</b>:<br><textarea name="user_eingabe" cols="75" rows="10" readonly></textarea></div><div style="clear:both; font-size:1px;"></div>
</div>
				');
} // end security check
?>